package com.hanson.common.bean;

import lombok.Data;

import java.io.Serializable;

/**
 * 全局返回消息类
 *
 * @author Administrator
 */
@Data
public class ResultMessage implements Serializable {
    private static final long serialVersionUID = 1L;
    private int code = 200;
    private String msg;
    private Object data;

    public ResultMessage() {
        super();
    }

    public static ResultMessage error(int code, String message) {
        ResultMessage result = new ResultMessage();
        result.code = code;
        result.msg = message;
        return result;
    }

    public static ResultMessage success(Object data, String message) {
        ResultMessage result = new ResultMessage();
        result.code = 200;
        result.data = data;
        result.msg = message;
        return result;
    }
}
